<?php  // content="text/plain; charset=utf-8"
//header('Content-type: image/png');
// Some data
$ydata = array();

foreach ($game_results as $game): 
    $ydata[] = $game->getScore();
    
endforeach;

if(empty($ydata)) {echo 'brak wyników';} else {

require_once ($_SERVER["DOCUMENT_ROOT"].'/jpgraph/jpgraph.php');
require_once ($_SERVER["DOCUMENT_ROOT"].'/jpgraph/jpgraph_line.php');
require_once ($_SERVER["DOCUMENT_ROOT"].'/jpgraph/jpgraph_scatter.php');

// Size of the overall graph
$width=600;
$height=420;

// Create the graph and set a scale.
// These two calls are always required
$graph = new Graph($width,$height);
$graph->SetScale('textlin');

// Setup margin and titles
$graph->SetMargin(40,0,40,0);
$graph->title->Set('Zdobyte punkty w grze ');
//$graph->subtitle->Set('Od: '..' Do: '.);
$graph->xaxis->title->Set('Nr rozgrywki');
$graph->yaxis->title->Set('Ilość zdobytych pkt');

// Create the linear plot
$lineplot=new LinePlot($ydata);
$lineplot->SetColor("#55bbdd");
$lineplot->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$lineplot->mark->SetColor('#55bbdd');
$lineplot->mark->SetFillColor('#55bbdd');
$lineplot->value->SetFormat('%d');
$lineplot->value->Show();
$lineplot->value->SetColor('#55bbdd');
$lineplot->SetCenter();

// Add the plot to the graph
$graph->Add($lineplot);

// Display the graph
$graph->Stroke(); 

}

?>